Currently, in order to prevent a panel of a terminal device from being mistakenly triggered when the terminal device is not used, many terminal devices such as mobile phones and tablet computers that use a capacitive touch panel or a resistive touch panel have a touch panel locking function and a touch panel unlocking function. For example, there are three or four virtual keys at a lower part of a touch panel of most mobile phones using an Android operating system, which, for example, are a menu key (menu), a home key (home), a back key (back), and a search key (search). In order to prevent a mobile phone from being mistakenly operated when the mobile phone is idle, a panel of the mobile phone may enter a locked state after the mobile phone keeps static for a period of time or a user actively presses a power (power) key or a panel locking key. In a panel locked state, an LCD (Liquid Crystal Display) is turned off, the mobile phone enters a sleep state, and neither a virtual key nor an AA (Active Area) that is on a touch panel (TP) responds to a touch operation. In this case, the virtual key and the touch panel are simultaneously locked. When the locked mobile phone needs to be unlocked, the power key or the panel locking key is pressed again, so that the LCD can be turned on, both a kernel program and the touch panel of the mobile phone are waken up, the virtual key and the touch panel are simultaneously unlocked, and both the virtual key and the AA area that is on the touch panel can respond to a touch operation, which completes unlocking of the virtual key and the touch panel of the mobile phone.
As a panel of a mobile phone becomes increasingly larger, and a frame becomes increasingly narrower, when a touch panel is used, it is more likely to mistakenly press a virtual key. In an existing locking or unlocking solution, when a virtual key and a touch panel are in an unlocked state, if a user presses the virtual key, a currently processed application is terminated, for example, when a game such as Fruit Ninja is played, and a finger needs to perform a slide operation on a full panel, a home key or a back key is often mistakenly pressed to terminate the game, which affects user experience.